import {HTTP_INTERCEPTORS} from '@angular/common/http';
import {AuthInterceptor} from './auth.interceptor';
import {ErrorInterceptor} from './error.interceptor';

/**
 * 配置 http 拦截器列表，然后在 services.module.ts 的 providers 引入此文件使其生效
 * https://angular.cn/guide/http#http-interceptors
 * https://www.jianshu.com/p/f14c9a98dbdf
 */
export const httpInterceptorProvidess = [
  {
    provide: HTTP_INTERCEPTORS,
    useClass: AuthInterceptor,
    multi: true
  },
  // {
  //   provide: HTTP_INTERCEPTORS,
  //   useClass: LogInterceptor,
  //   multi: true
  // },
  // {
  //   provide: HTTP_INTERCEPTORS,
  //   useClass: CacheInterceptor,
  //   multi: true
  // },
  {
    provide: HTTP_INTERCEPTORS,
    useClass: ErrorInterceptor,
    multi: true
  }
];
